import 'package:flutter/material.dart';
import 'package:flutter_widget_from_html_core/flutter_widget_from_html_core.dart';
import 'package:get/get.dart';
import 'package:ichinesereader/exam/dto/assessment.response.dart';
import 'ExamQuestionIndexPage.dart';
import 'controllers/ExamPageController.dart';
import 'package:intl/intl.dart';

///
// *Part 试卷章节， 最高级别的 章节
////
class ExamPartStartPromptPage extends GetView<ExamPageController> {
  const ExamPartStartPromptPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    UiQuestionStep? uiQuestionStep = controller.currentQuestionStep;
    int partIndex = uiQuestionStep?.partIndex ?? 0;
    QuestionPart? questionPart = controller.assessmentResult?.list![partIndex];
    String introduction = questionPart?.introduction ?? '';
    String questionTitle = '';
    if(Get.arguments != null) questionTitle = Get.arguments['questionTitle'];
    if (introduction.isEmpty){
      introduction = questionTitle;
    }
    Widget mainContent = Container(
      padding: const EdgeInsets.all(20),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          HtmlWidget(introduction,textStyle: TextStyle(
              fontSize: 18,
              color: (Get.isDarkMode
                  ? Color(0xFF757575)
                  : Colors.black87),
              height: 1.8,
              wordSpacing: 1.5)),
          HtmlWidget(
              '© iChineseReader ${DateFormat('yyyy').format(DateTime.now()).toString()}',textStyle: TextStyle(
              fontSize: 18,
              color: (Get.isDarkMode
                  ? Color(0xFF757575)
                  : Colors.black87),
              height: 1.8,
              wordSpacing: 1.5)),
        ],
      ),
    );
    var borderContainer = Container(
      // decoration: ExamLayoutUtil.getBoxDecoration(),
      width: double.infinity, //代表百分百宽度
      child: mainContent,
    );

    return borderContainer;
  }
}
